# CMakeLists.txt
# Makefile for build miragon solution
# @author Varphone Wong <varphone@qq.com>
# @date   2018/06/14
#

cmake_minimum_required(VERSION 3.0.2)

project(miragon
	VERSION 1.0.0
)

# Build options
option(BUILD_SRC      "Build sources"   ON)
option(BUILD_DOCS     "Build documents" OFF)
option(BUILD_EXAMPLES "Build examples"  OFF)
option(BUILD_TESTS    "Build tests"     ON)
option(BUILD_TOOLS    "Build tools"     OFF)

set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

# Find depends
if(UNIX)
	find_package(PkgConfig QUIET)
#	pkg_check_modules(GLIB2 REQUIRED glib-2.0)
#	pkg_check_modules(GST1 REQUIRED gstreamer-1.0)
#	pkg_check_modules(GST1_VIDEO REQUIRED gstreamer-video-1.0)
endif()

set(Boost_USE_STATIC_LIBS        ON)
set(Boost_USE_MULTITHREADED      ON)
find_package(Boost REQUIRED COMPONENTS program_options)

add_compile_options(-fno-exceptions)

# Exported Variables
set(MIRAGON_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
set(MIRAGON_VERSION_MINOR ${PROJECT_VERSION_MINOR})
set(MIRAGON_VERSION_PATCH ${PROJECT_VERSION_PATCH})
set(MIRAGON_VERSION ${PROJECT_VERSION})
set(MIRAGON_VERSION_STRING "${MIRAGON_VERSION}")

# config.h
configure_file(
	${CMAKE_SOURCE_DIR}/include/miragon/config.h.in
	${CMAKE_SOURCE_DIR}/include/miragon/config.h
	@ONLY)

# Subdirectories
if(BUILD_SRC)
	add_subdirectory(src)
endif()
if(BUILD_DOCS)
	add_subdirectory(docs)
endif()
if(BUILD_EXAMPLES)
	add_subdirectory(examples)
endif()
if(BUILD_TESTS)
	add_subdirectory(tests)
endif()
if(BUILD_TOOLS)
	add_subdirectory(tools)
endif()
